﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace LMIS_Application.members
{
    public partial class AddMember : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAddMember_Click(object sender, EventArgs e)
        {
            //add the new member
            Member m = new Member();
            m.Name = tb_AM_Name.Text;
            m.Address = tb_AM_Address.Text;
            m.Phone = Convert.ToInt64(tb_AM_Phone.Text);
            m.Status = "Valid";
            bool success = m.SaveMember();

            string resultMessage = "";
            if (success)
            {
                resultMessage = "Member " + m.Name + " added successfully.";
            }
            else
            {
                resultMessage = "Membership record for " + m.Name + " could not be added.";
            }

            msgSuccess.InnerHtml = resultMessage;

        }
    }
}
